//
//  LSZNearViewController.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/8/18.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZNearViewController.h"
#import "LCUtils.h"

@interface LSZNearViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong) UILabel * labelTitle;
@property(nonatomic,strong) UIButton * butok;

@property(nonatomic,strong) UITableView * tableViewCity;
@property(nonatomic,assign) NSInteger page;
@property(nonatomic,strong) NSMutableArray * mutArrayData;
@property(nonatomic,strong) LSZEmptyDataVC * emptyDataVC;
@end

@implementation LSZNearViewController

#pragma mark - 大小正常显示
-(void)initWithSize
{
    CGRect rect = self.tableViewCity.frame;
    rect.size.width =ScreenWidth;
    self.tableViewCity.frame = rect;
}
#pragma mark - 大小不显示
-(void)initWithNoSize
{
    CGRect rect = self.tableViewCity.frame;
    rect.size.width =0;
    self.tableViewCity.frame = rect;
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self initWithSize];
    self.tableViewCity.hidden = NO;
    if([[_UserM usercode] isEqualToString:@""]&& ![self.comeFrome isEqualToString:@"1"]){
        [self initWithNoSize];
        [self setDisplayOfErrorInformation:@"由于你还没登录,登录后才能看到相关信息" :@"去登录"];
    }else{
        if ([self.is_city isEqualToString:@"1"]) {
            NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
            NSString *result = NullStringjudgment([defaults objectForKey:@"location"]);
            if (result.length > 0) {
                if (self.mutArrayData.count >0) {
                    [self initWithCityDataWithPage:self.page fuid:@""];
                }else{
                    [self.tableViewCity reloadData];
                }
            }else{
                [LSZRequestResolutionDic initWithGetUserInformation:^(BOOL isOK, NSString * str, LSZPersonalInformationManager * manager) {
                    if (isOK == YES) {
                        NSString *result = NullStringjudgment([defaults objectForKey:@"location"]);
                        if (result.length > 0) {
                            //有地区
                            if (self.mutArrayData.count >0) {
                                [self getCityDataFuid:@""];
                            }else{
                                [self.tableViewCity reloadData];
                            }
                        }else{
                            //没地区
                            [self initWithNoSize];
                            [self setDisplayOfErrorInformation:@"由于你还没设置区域信息,设置后可以看到同城信息呀!" :@"去设置"];
                        }
                    }
                }];
            }
        }else if ((NullStringjudgment(NSStr(self.fuid))).length >0){
            if (self.mutArrayData.count >0) {
                [self.tableViewCity reloadData];
            }else{
                //特定人的信息
                [self initWithCityDataWithPage:self.page fuid:self.fuid];
            }
        }
        else{
            if (self.mutArrayData.count >0) {
                [self.tableViewCity reloadData];
            }else{
                //关注人的动态
                [self initWithCityDataWithPage:self.page fuid:@""];
            }
        }
    }
}
-(void)youGetTheFirstData
{
    if([[_UserM usercode] isEqualToString:@""]&& ![self.comeFrome isEqualToString:@"1"]){
        [self initWithNoSize];
        [self setDisplayOfErrorInformation:@"由于你还没登录,登录后才能看到相关信息" :@"去登录"];
    }else{
        if ([self.is_city isEqualToString:@"1"]) {
            NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
            NSString *result = NullStringjudgment([defaults objectForKey:@"location"]);
            if (result.length > 0) {
                //有地区
                [self getCityDataFuid:@""];
            }else{
                [LSZRequestResolutionDic initWithGetUserInformation:^(BOOL isOK, NSString * str, LSZPersonalInformationManager * manager) {
                    if (isOK == YES) {
                        NSString *result = NullStringjudgment([defaults objectForKey:@"location"]);
                        if (result.length > 0) {
                            //有地区
                            [self getCityDataFuid:@""];
                        }else{
                            //没地区
                            [self initWithNoSize];
                            [self setDisplayOfErrorInformation:@"由于你还没设置区域信息,设置后可以看到同城信息呀!" :@"去设置"];
                        }
                    }
                }];
            }
        }else if ((NullStringjudgment(NSStr(self.fuid))).length >0){
            [self getCityDataFuid:self.fuid];//特定人的信息
        }
        else{
            [self getCityDataFuid:@""];//关注人的动态
        }
    }
}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [self.emptyDataVC removeFromSuperview];
    [self.labelTitle removeAllSubviews];
    [self.butok removeAllSubviews];
    self.labelTitle.hidden = YES;
    self.butok.hidden = YES;
    if (self.tableViewCity.frame.size.width != ScreenWidth) {
        [self initWithSize];
    }
}
#pragma mark - 得到同城和关注的信息
-(void)getCityDataFuid:(NSString *)fuid
{
    [self addMoreData];
    self.page = 1;
    [self initWithCityDataWithPage:self.page fuid:fuid];
    [self.view addSubview:_tableViewCity];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.mutArrayData = [[NSMutableArray alloc]init];
    [self youGetTheFirstData];
}
-(void)initWithCityDataWithPage:(NSInteger)page fuid:(NSString *)fuid
{
    __weak typeof(self) weakSelf = self;
    [LSZRequestResolutionDic allDynamicLists:@"" id_id:@"" type:@"" fuid:fuid selfStr:@"" theme:@"" page:[NSString stringWithFormat:@"%ld",(long)page] is_city:self.is_city is_follow:self.is_follow hot:@"" :^(BOOL isOK, NSString * string, LSZAllDynamicListsManager * manager) {
        if (isOK == YES) {
            if (page == 1) {
                [weakSelf.mutArrayData  removeAllObjects];
                [weakSelf.mutArrayData addObjectsFromArray:manager.arrayData];
                if (manager.arrayData.count == 0) {
                    weakSelf.tableViewCity.mj_footer.hidden = YES;
                    weakSelf.emptyDataVC = [[LSZEmptyDataVC alloc]init];
                    [weakSelf.emptyDataVC showWithView:weakSelf.tableViewCity];
                }
            }else{
                [weakSelf.mutArrayData addObjectsFromArray:manager.arrayData];
                if (manager.arrayData.count == 0) {
                    [weakSelf.tableViewCity.mj_footer endRefreshingWithNoMoreData];
                }
            }
            [self.tableViewCity reloadData];
        }else{
            [self initWithtring:string];
        }
    }];
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.00001;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    if(section == self.mutArrayData.count-1){
        return 20;
    }else{
        return 0.0001;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    LSZAllDynamicListsMg * mg = nil;
    mg = self.mutArrayData[indexPath.section];
    if(indexPath.row == 0){
        float A = [LSZSpecialPackaging initWithReturnsthesizeOf:13.5 :0.5];
        int C;
        if (ScreenWidth == 320) {
            C = 70;
        }else if(ScreenWidth == 375){
            C = 77;
        }else {
            C = 85;
        }
        NSString * string = [NSString stringWithFormat:@"%@%@",mg.theme_content,mg.content];
        CGFloat sizeImage = [LSZSpecialPackaging initWithReturnsthesizeOf:45 :5];
        CGFloat height;
        if ([string isEqualToString:@""]) {
            height = 0;
        }else{
            height = [LSZSpecialPackaging caculateHeightOfText:ScreenWidth-sizeImage-25 height:80 font:A :string];
        }
        return  height-10+C;
    }else if(indexPath.row == 1){
        CGFloat heightA = [LSZSpecialPackaging initWithReturnsthesizeOf:60 :5];

        CGFloat wids = (ScreenWidth-30-heightA)/3;
        if(mg.arrayImages.count == 0){
            return  0.00001;
        }
        else if (mg.arrayImages.count == 1) {
            return (ScreenWidth-30-heightA)/2+10;
        }else{
            if(mg.arrayImages.count%3 == 0){
                return (mg.arrayImages.count/3)*(wids+10)+10;
            }else{
                return (mg.arrayImages.count/3+1)*(wids+10)+10;
            }
        }
    }else if (indexPath.row == 2){
        if (mg.resources_name.length ==0) {
            return 0.0001;
        }else{
            CGFloat size = [LSZSpecialPackaging initWithReturnsthesizeOf:50 :5];
            return size;
        }
    }
    return 80;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return  self.mutArrayData.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    __weak typeof(self) weakSelf = self;
    if (self.mutArrayData.count > indexPath.section) {
        LSZAllDynamicListsMg * mg = nil;
        mg = weakSelf.mutArrayData[indexPath.section];
        if (indexPath.row == 0) {
            LSZBasicInformationCollectionViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZBasicInformationCollectionViewCell" forIndexPath:indexPath];
            cell.AllDynamicListsMg = mg;
            [cell.butFocusOn tapGesture:^(UIGestureRecognizer *ges) {
                [weakSelf clickButFocusOnDetaill:mg.uid :indexPath.section :mg];
            }];
            [cell.imageHeader tapGesture:^(UIGestureRecognizer *ges) {
                LSZPersonalInformationPageVC * vc = [[LSZPersonalInformationPageVC alloc]init];
                vc.uid =mg.uid;
                vc.imageViewHeader = mg.avatar;
                [weakSelf.navigationController pushViewController:vc animated:YES];
            }];
            cell.selectionStyle = UITableViewCellSelectionStyleNone ;
            return cell;
        }else if (indexPath.row == 1){
            LSZImageViewFocusOnTableViewCell * cell = [[LSZImageViewFocusOnTableViewCell alloc]initWithImageViewFocusOn:mg.arrayImages];
            cell.selectionStyle = UITableViewCellSelectionStyleNone ;
            return cell;
        }else if (indexPath.row == 2){
            if (mg.resources_name.length ==0) {
                UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
                if (!cell) {
                    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
                }
                cell.selectionStyle = UITableViewCellSelectionStyleNone ;
                return cell;
            }
            LSZAddMusicCollectionViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZAddMusicCollectionViewCell" forIndexPath:indexPath];
            cell.AllDynamicListsMg = mg;
            cell.selectionStyle = UITableViewCellSelectionStyleNone ;
            return cell;
        }
        else{
            LSZThumbUpForwardCollectionViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZThumbUpForwardCollectionViewCell" forIndexPath:indexPath];
            cell.AllDynamicListsMg = mg;
            [cell.imageViewEvaluation tapGesture:^(UIGestureRecognizer *ges) {
                [weakSelf goToDynamicReview:mg];
            }];
            [cell.labelEvaluation tapGesture:^(UIGestureRecognizer *ges) {
                [weakSelf goToDynamicReview:mg];
            }];
            [cell.imageViewShare tapGesture:^(UIGestureRecognizer *ges) {
                [self labelShareClickWithMg:mg section:indexPath.section];
            }];
            [cell.labelShare tapGesture:^(UIGestureRecognizer *ges) {
                [self labelShareClickWithMg:mg section:indexPath.section];
            }];
            [cell.imageViewZan tapGesture:^(UIGestureRecognizer *ges) {
                [weakSelf initWiththeDynamicPointOfPraise:mg :indexPath.section];
            }];
            [cell.labelZan tapGesture:^(UIGestureRecognizer *ges) {
                [weakSelf initWiththeDynamicPointOfPraise:mg :indexPath.section];
            }];
            [cell.butMore tapGesture:^(UIGestureRecognizer *ges) {
                [self chooseToReport:mg];
            }];
            cell.selectionStyle = UITableViewCellSelectionStyleNone ;
            return cell;
        }
    }else{
        UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
        if (!cell) {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone ;
        return cell;
    }
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0||indexPath.row == 1) {
        LSZAllDynamicListsMg * mg = nil;
        mg = self.mutArrayData[indexPath.section];
        LSZDynamicCommentDetailsVC * vc = [[LSZDynamicCommentDetailsVC alloc]init];
        vc.AllDynamicListsMg = mg;
        [self.navigationController pushViewController:vc animated:YES];
    }
    else if (indexPath.row == 2) {
        LSZAllDynamicListsMg * mg = nil;
        mg = self.mutArrayData[indexPath.section];
        NSString * str = [[NSString alloc]init];
        NSString * id_id_str = [[NSString alloc]init];
        if ([mg.type isEqualToString:@"2"]) {
            str = @"/Music/get_url";
        }else if ([mg.type isEqualToString:@"5"]){
            str = @"/Music/artist";
        }else{
            str = @"/Music/album";
        }
        id_id_str = mg.resources_id;
        [LSZRequestResolutionDic dynamicGetsAlbumArtistSongDataBasedOn:id_id_str URL:str type:mg.type :^(BOOL isOk, NSString * string, LSZNewAudioHomepageManager * manager) {
            if (isOk == YES) {
                if ([mg.type isEqualToString:@"2"]) {
                    //NSLog(@"音频播放");
                    [LCUtils lcListPlayWithLSZNewAudioHomepageManager:manager];
                }else{
                    LSZNewAudioPlayImageAndTableViewVC * vc = [[LSZNewAudioPlayImageAndTableViewVC alloc]init];
                    LSZNewAudioHomepageMg * audioMg = nil;
                    audioMg = manager.arrayData[0];
                    [LCUtils albumArtistDetailsInterfaceJump:vc audioMg:audioMg typeComeWhere:@"1"];
                    vc.lastPageNumberRow = [NSString stringWithFormat:@"%ld",(long)indexPath.row];
                    vc.lastSection = [NSString stringWithFormat:@"%ld",(long)indexPath.section-1];
                    [self.navigationController pushViewController:vc animated:YES];
                }
            }
        }];
    }
}
#pragma mark - 选择举报
-(void)chooseToReport:(LSZAllDynamicListsMg *)manager
{
    ACActionSheet *actionSheet = [[ACActionSheet alloc] initWithTitle:nil cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@[@"举报"] actionSheetBlock:^(NSInteger buttonIndex) {
        if (buttonIndex == 0) {
            LSZReportViewController * VC = [[LSZReportViewController alloc]init];
            VC.name = manager.username;
            VC.titleString = manager.content;
            VC.tid = manager.id_id;
            VC.type = @"1";
            VC.comment_id = @"";
            [self.navigationController pushViewController:VC animated:YES];
        }
    }];
    [actionSheet show];
}
#pragma mark - 进入动态评论
-(void)goToDynamicReview :(LSZAllDynamicListsMg *)mg
{
    LSZDynamicCommentDetailsVC * vc = [[LSZDynamicCommentDetailsVC alloc]init];
    vc.AllDynamicListsMg = mg;
    [self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - 对动态点赞
-(void)initWiththeDynamicPointOfPraise :(LSZAllDynamicListsMg *)mg :(NSInteger)section
{
    if([[_UserM usercode] isEqualToString:@""]){
        pushAccLoginVC;
        return;
    }
    NSString * ck = [[NSString alloc]init];
    NSString * mode = [[NSString alloc]init];
    if ([mg.is_admire isEqualToString:@"0"]) {
        ck = @"0";//点赞
        mode = @"";
    }else{
        ck = @"";//取消点赞
        mode = @"1";
    }
    [LSZRequestData theDynamicPointOfPraise:mg.id_id type:@"1" ck:ck mode:mode :^(BOOL isOk, NSString * string, NSDictionary * dic) {
        if (isOk == YES) {
            if([ck isEqualToString:@"0"]){
                mg.is_admire = @"1";
                mg.admire_num = [NSString stringWithFormat:@"%ld",(long)([mg.admire_num integerValue]+1)];
                [self initWithtring:@"点赞成功!"];
            }else{
                mg.is_admire = @"0";
                mg.admire_num = [NSString stringWithFormat:@"%ld",(long)([mg.admire_num integerValue]-1)];
                [self initWithtring:@"取消点赞!"];
            }
            LSZThumbUpForwardCollectionViewCell * cell = (LSZThumbUpForwardCollectionViewCell *)[self.tableViewCity cellForRowAtIndexPath:[NSIndexPath indexPathForRow:3  inSection:section]];

            if([mode isEqualToString:@"1"]){
                cell.imageViewZan.image = [UIImage imageNamed:@"点赞"];

            }else{
                cell.imageViewZan.image = [UIImage imageNamed:@"我的_签到_留言_已点赞"];
            }
            cell.labelZan.text = mg.admire_num;
        }else{
            [self initWithtring:string];
        }
    }];
}
#pragma mark - 关注
-(void)clickButFocusOnDetaill :(NSString *)uid :(NSInteger)section :(LSZAllDynamicListsMg *)mg
{
    if([[_UserM usercode] isEqualToString:@""]){
        pushAccLoginVC;
    }else{
        [LSZRequestData payAttentionToOthers:uid Ck:@"0" mode:@"0" :^(BOOL isOk, NSString * str, NSDictionary * dic) {
            if (isOk == YES) {
                [self initWithtring:@"关注成功!"];
                LSZBasicInformationCollectionViewCell * cell = (LSZBasicInformationCollectionViewCell *)[self.tableViewCity cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0  inSection:section]];
                [cell.butFocusOn setTitle:@"已关注" forState:UIControlStateNormal];
                cell.butFocusOn.backgroundColor =  partialShallow;
                cell.butFocusOn.userInteractionEnabled = NO;
            }else{
                [self initWithtring:str];
            }
        }];
    }
}
-(UITableView *)tableViewCity
{
    if (_tableViewCity == nil) {
        _tableViewCity = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight-TAB_BAR_HEIGHT-NAVIGATION_BAR_HEIGHT) style:UITableViewStyleGrouped];
        _tableViewCity.delegate = self;
        _tableViewCity.dataSource = self;
        _tableViewCity.separatorColor = divider;
        _tableViewCity.estimatedRowHeight =0;
        _tableViewCity.estimatedSectionFooterHeight =0;
        _tableViewCity.estimatedSectionHeaderHeight =0;
        _tableViewCity.separatorInset = UIEdgeInsetsMake(0, 20, 0, 20);
        _tableViewCity.separatorStyle = UITableViewCellSeparatorStyleNone;
        [self.view addSubview:_tableViewCity];
    }
    return _tableViewCity;
}
-(void)addMoreData
{
    [self.tableViewCity registerClass:[LSZBasicInformationCollectionViewCell class] forCellReuseIdentifier:@"LSZBasicInformationCollectionViewCell"];
    [self.tableViewCity registerClass:[LSZAddMusicCollectionViewCell class] forCellReuseIdentifier:@"LSZAddMusicCollectionViewCell"];
    [self.tableViewCity registerClass:[LSZThumbUpForwardCollectionViewCell class] forCellReuseIdentifier:@"LSZThumbUpForwardCollectionViewCell"];
    self.tableViewCity.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        self.page = 1;
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [self initWithCityDataWithPage :self.page fuid:NullStringjudgment(NSStr(self.fuid))];
            [self.tableViewCity.mj_header endRefreshing];
        });
    }];
    self.tableViewCity.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
        self.page++;
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [self initWithCityDataWithPage:self.page fuid:NullStringjudgment(NSStr(self.fuid))];
            [self.tableViewCity.mj_footer endRefreshing];
        });
    }];
}
#pragma mark - 没登录或者没有设置用户的地址信息
-(void)setDisplayOfErrorInformation :(NSString *)string :(NSString *)strTitle
{
    self.labelTitle = [[UILabel alloc]init];
    self.labelTitle.textColor = titleColorLSZ;
    [LSZSpecialPackaging setAnySizeLabel:self.labelTitle :16];
    self.labelTitle.numberOfLines = 0;
    self.labelTitle.textAlignment = NSTextAlignmentCenter;
    self.labelTitle.frame = CGRectMake(50, ScreenHeight/3-50, ScreenWidth-100, 50);
    self.labelTitle.text = string;
    [self.view addSubview:self.labelTitle];

    self.butok = [[UIButton alloc]init];
    self.butok.backgroundColor = redUIColor;
    CGFloat font = [LSZSpecialPackaging  initWithReturnsthesizeOf:45 :5];
    self. butok.frame = CGRectMake((ScreenWidth-100)/2, CGRectGetMaxY(self.labelTitle.frame)+20, 100, font);
    [self.butok setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.butok setTitle:strTitle forState:UIControlStateNormal];
    if ([strTitle isEqualToString:@"去登录"]) {
        self.butok.tag = 1;
    }else{
        self.butok.tag = 2;
    }
    [self.butok.layer setMasksToBounds:YES];
    [self.butok.layer setCornerRadius:4];
    [self.butok addTarget:self action:@selector(clickButOk:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.butok];
}
-(void)clickButOk:(UIButton *)button
{
    if (button.tag == 1) {
        pushAccLoginVC;
        return;
    }else{
        LSZPersonalInformationVC * vc = [[LSZPersonalInformationVC alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }
    [self.view removeAllSubviews];
}
#pragma mark - 送积分
- (void)labelShareClickWithMg:(LSZAllDynamicListsMg *)mg section:(NSInteger)section
{
    if([[_UserM usercode] isEqualToString:@""]){
        pushAccLoginVC;
        return;
    }
    LCSendSugarDemo6 *sendSugar = [[LCSendSugarDemo6 alloc] init];
    sendSugar.mg = mg;
    CGRect rect = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width - 40, 360);
    sendSugar.frame = rect;
    [sendSugar.undoButton addTarget:self action:@selector(undoButtonClick) forControlEvents:(UIControlEventTouchUpInside)];
    @weakify(self)
    [sendSugar.sugarListBut tapGesture:^(UIGestureRecognizer *ges) {
        @strongify(self)
        [self sugarListButClickWithMg:mg];
    }];
    sendSugar.successBlock = ^{
        @strongify(self)
        [self.zh_popupController dismiss];
    };
    self.zh_popupController = [zhPopupController new];
    self.zh_popupController.layoutType = zhPopupLayoutTypeCenter;
    [self.zh_popupController presentContentView:sendSugar duration:0.25 springAnimated:false];
}
- (void)undoButtonClick
{
    [self.zh_popupController dismiss];
}
- (void)sugarListButClickWithMg:(LSZAllDynamicListsMg *)mg
{
    [self.zh_popupController dismiss];
    LCSugarListTableViewController *viewController = [[LCSugarListTableViewController alloc] init];
    viewController.mg = mg;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        viewController.title = @"赠送列表";
    });
    [self.navigationController pushViewController:viewController animated:YES];
}
@end
